package com.study.service.impl;

import com.study.dao.ThumbDao;
import com.study.pojo.Thumb;
import com.study.service.ThumbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author Miss kun
 * @Date 2020/10/16 17:21
 * @Version 1.0
 */
@Service
public class ThumbServiceImpl implements ThumbService {

    @Autowired
    private ThumbDao thumbDao;

    @Override
    public int insertThumb(Thumb thumb) {
        return thumbDao.insertThumb(thumb);
    }

    @Override
    public boolean findThumbByUserIdAndBookId(Integer userId, Integer bookId) {
        return thumbDao.findThumbByUserIdAndBookId(userId,bookId) != null ? true :false;
    }

    @Override
    public Thumb findThumbByUserIdAndBook(Integer userId, Integer bookId) {
        return thumbDao.findThumbByUserIdAndBookId(userId,bookId);
    }

    @Override
    public int updateStatus(Integer userId, Integer bookId,Integer status) {
        return thumbDao.updateStatus(userId,bookId,status);
    }

    @Override
    public int getBookCountByGroup(Integer bookId) {
        return thumbDao.getBookCountByGroup(bookId);
    }
}
